package com.lianzhihui.romeex.ui.me;

import android.graphics.drawable.Drawable;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.lianzhihui.romeex.R;
import com.lianzhihui.romeex.adapter.MessageActivityAdapter;
import com.lianzhihui.romeex.ui.base.BaseActivity;
import com.lianzhihui.romeex.ui.me.dialog.ShareDialog;
import com.lianzhihui.romeex.utils.DensityUtil;
import com.lianzhihui.romeex.utils.NoDoubleClickUtils;
import com.lianzhihui.romeex.utils.StatusBarUtil;
import com.lianzhihui.romeex.widget.ZFEmptyRecyclerView;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;

import java.text.MessageFormat;
import java.util.ArrayList;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @ProjectName: romeex
 * @Package: com.lianzhihui.romeex.ui.me
 * @ClassName: MessageActivity
 * @Description: java类作用描述
 * @Author: zhanghong
 * @CreateDate: 2020/11/2 14:44
 * @UpdateUser: 更新者：
 * @UpdateDate: 2020/11/2 14:44
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */
public class MessageActivity extends BaseActivity implements OnRefreshLoadMoreListener, BaseQuickAdapter.OnItemClickListener {
    @BindView(R.id.include_top_iv_back)
    ImageView includeTopIvBack;
    @BindView(R.id.include_top_lin_newback)
    LinearLayout includeTopLinNewback;
    @BindView(R.id.include_top_tv_title)
    TextView includeTopTvTitle;
    @BindView(R.id.include_top_iv_right_second)
    ImageView includeTopIvRightSecond;
    @BindView(R.id.include_top_tv_right)
    TextView includeTopTvRight;
    @BindView(R.id.include_top_lin_right)
    LinearLayout includeTopLinRight;
    @BindView(R.id.include_top_lin_background)
    LinearLayout includeTopLinBackground;
    @BindView(R.id.app_top_bar)
    LinearLayout appTopBar;
    @BindView(R.id.myRecyclerView)
    ZFEmptyRecyclerView myRecyclerView;
    @BindView(R.id.mySmartRefreshLayout)
    SmartRefreshLayout mySmartRefreshLayout;
    private MessageActivityAdapter messageTransferAdapter;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_message;
    }


    @Override
    protected void initView() {
        StatusBarUtil.setTransparent(this);
        StatusBarUtil.setStatusBarTextColor(this, false);
        mySmartRefreshLayout.setOnRefreshLoadMoreListener(this);
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        ArrayList<String> objects = new ArrayList<>();
        for (int i = 0; i < 20; i++) {
            objects.add("" + i);
        }
        messageTransferAdapter = new MessageActivityAdapter(this, objects);
        messageTransferAdapter.setOnItemClickListener(this);
        myRecyclerView.setLayoutManager(linearLayoutManager);
        myRecyclerView.setAdapter(messageTransferAdapter);
        includeTopTvTitle.setText(MessageFormat.format("{0}(0)", getResources().getText(R.string.text_message)));
        includeTopTvRight.setText(getResources().getText(R.string.text_read_all));
        includeTopTvRight.setBackground(getResources().getDrawable(R.drawable.tv_stoke_white_11dp));
        Drawable drawable = getResources().getDrawable(R.drawable.icon_clear);
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.gravity = Gravity.CENTER_VERTICAL;
        params.setLayoutDirection(LinearLayout.VERTICAL);
        params.setMargins(10,0,10,0);

        includeTopTvRight.setLayoutParams(params);
        drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight());
        includeTopTvRight.setCompoundDrawables(drawable, null, null, null);
        includeTopTvRight.setPadding(20, 5, 20, 5);

    }

    @Override
    protected void initData() {

    }

    @OnClick({R.id.include_top_iv_back, R.id.include_top_iv_right_second})
    public void OnClick(View v) {
        switch (v.getId()) {

            case R.id.include_top_iv_back:
                finish();
                break;
            case R.id.include_top_iv_right_second:

                break;

            default:
                break;
        }
    }


    @Override
    public void onRefresh(@NonNull RefreshLayout refreshLayout) {

    }

    @Override
    public void onLoadMore(@NonNull RefreshLayout refreshLayout) {

    }

    @Override
    public void onItemClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {

    }
}
